


<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	template="template/template.xhtml" xmlns:p="http://primefaces.org/ui">
	<ui:define name="title">View taxi manage page</ui:define>

	<ui:define name="script">
		<script language="javascript">
			function confirmDelete() {
				x = window.confirm('Are you sure?');
				if (x)
					return true;
				else
					return false;
			}
		</script>
	</ui:define>

	<ui:define name="menu">
		<ul>
			<li><a href='service.jsf'><span>Service</span></a></li>
			<li class="active"><a href='taxi.jsf'><span>Taxi</span></a></li>
			<li><a href='map-view.jsf'><span>Map</span></a></li>

			<li><a href='customer.jsf'><span>Customer</span></a></li>
			<li><a href='user.jsf'><span>User</span></a></li>

		</ul>
	</ui:define>

	<ui:define name="main-content">
		<p:growl id="growl"></p:growl>
		<div
			style="width: 960; min-height: 700px; margin-left: 10px; margin-right: 10px">
			<div style="text-align: center;">
				<p:commandLink actionListener="#{taxi.addTaxiClick}"
					value="Click to add Taxi">
				</p:commandLink>
				<h:form style=""> Search :
				<p:inputText id="number" value="#{taxi.number}">
						<p:ajax event="keyup" listener="#{taxi.valueChanged}"
							update=":taxiTable"></p:ajax>
					</p:inputText>
					<p:watermark value="Search by number plate" for="number"></p:watermark>
				</h:form>

				(Number plate, Ex: 59-Y1 4324)
			</div>
			<br></br>
			<hr style="border-color: silver;"></hr>
			<h:panelGroup id="taxiTable">
				<h:form id="display">

					<p:confirmDialog id="confirmDialog" message="Are you sure?"
						header="Initiating delete process" severity="alert"
						widgetVar="confirmation">

						<p:commandButton id="confirm" value="Yes Sure"
							update=":taxiTable,:growl" oncomplete="confirmation.hide()"
							actionListener="#{taxi.deleteTaxi}" />
						<p:commandButton id="decline" value="Not Yet"
							onclick="confirmation.hide()" type="button" />
					</p:confirmDialog>

					<p:contextMenu for="tableData">
						<p:menuitem value="Edit" actionListener="#{taxi.editTaxi}" />
						<p:menuitem value="Delete" onclick="confirmation.show()"></p:menuitem>
					</p:contextMenu>
					<p:dataTable value="#{taxi.taxies}" style="color:black"
						id="tableData" rendered="#{taxi.hasTaxi}"
						columnClasses="imei,numberPlate,seat,driver,edit,delete,view"
						var="item" paginator="true" rows="10"
						paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
						rowsPerPageTemplate="5,10,15" selectionMode="single"
						selection="#{taxi.taxi}" rowKey="#{item}">

						<p:ajax event="rowSelect" update=":display" oncomplete="taxiDialog.show()"></p:ajax>

						<p:column style="text-align: center;">
							<f:facet name="header">Id</f:facet> #{item.taxiId}
						</p:column>
						<p:column style="text-align: center;">
							<f:facet name="header">Imei</f:facet> #{item.imei}</p:column>
						<p:column>
							<f:facet name="header">Description</f:facet>
							<div style="width: 100px">
								<h:outputText style="word-wrap: break-word;"
									value="#{item.description}"></h:outputText>
							</div>
						</p:column>
						<p:column style="text-align: center;">
							<f:facet name="header">Number Plate</f:facet>#{item.numberPlate}</p:column>
						<p:column style="text-align: center;"
							sortBy="#{item.numberOfSeat}">
							<f:facet name="header">Seat</f:facet>#{item.numberOfSeat}</p:column>
						<p:column>
							<f:facet name="header">Driver Name</f:facet>#{item.driverName}</p:column>
						<p:column style="text-align: center;">
							<f:facet name="header">Creation Time</f:facet>
							<h:outputText value="#{item.creationTime}">
								<f:convertDateTime pattern="dd/MM/yyyy"></f:convertDateTime>
							</h:outputText>
						</p:column>
						<p:column style="text-align: center;">
							<f:facet name="header">Last Update</f:facet>
							<h:outputText value="#{item.lastUpdate}">
								<f:convertDateTime pattern="dd/MM/yyyy"></f:convertDateTime>
							</h:outputText>
						</p:column>
						<p:column style="text-align: center;">
							<f:facet name="header">View Route</f:facet>
							<h:commandLink value="click" action="#{map.view}">
								<f:param name="id" value="#{item.taxiId}"></f:param>
							</h:commandLink>
						</p:column>
					</p:dataTable>

					<p:dialog id="dialog" header="Taxi Basic Detail"
						widgetVar="taxiDialog" resizable="true" showEffect="explode"
						hideEffect="explode">
						<h:panelGrid id="display" columns="2" cellpadding="4">
							<f:facet name="header">
								<p:graphicImage value=" images/Taxi_icon1.png" />
							</f:facet>

							<h:outputText value="Imei:" />
							<h:outputText value="#{taxi.taxi.imei}" />

							<h:outputText value="Description:" />
							<h:outputText
								value="#{taxi.taxi.description} with #{taxi.taxi.numberOfSeat} seats" />

							<h:outputText value="Sim number:" />
							<h:outputText value="#{taxi.taxi.simNumber}" />

							<h:outputText value="Ip:" />
							<h:outputText value="#{taxi.taxi.ipAddress}" />

							<h:outputText value="Port:" />
							<h:outputText value="#{taxi.taxi.portListen}" />

							<h:outputText value="Creation time:" />
							<h:outputText value="#{taxi.taxi.creationTime}">
								<f:convertDateTime pattern="dd/MM/yyyy"></f:convertDateTime>
							</h:outputText>

							<h:outputText value="Expiration time:" />
							<h:outputText value="#{taxi.taxi.expirationTime}">
								<f:convertDateTime pattern="dd/MM/yyyy"></f:convertDateTime>
							</h:outputText>

							<h:outputText value="Driver phone:" />
							<h:outputText value="#{taxi.taxi.driverPhone}" />

							<h:outputText value="Driver name:" />
							<h:outputText value="#{taxi.taxi.driverName}" />
						</h:panelGrid>
					</p:dialog>
				</h:form>
			</h:panelGroup>
		</div>
	</ui:define>

</ui:composition>












